<?php
/**
 * Created by PhpStorm.
 * User: silvery
 * Date: 2016/10/8
 * Time: 18:51
 */
    $line = 1;
    while($line <=9){
        $empty_pos = $star_pos = 1;
        $empty = 9-$line;
        $star = 2*$line-1;
        while($empty_pos <=$empty){
            echo '&nbsp;';
            ++$empty_pos;
        }
        while($star_pos <= $star){
            echo '*';
            ++$star_pos;
        }
        echo'<br>';
        ++$line;
    }